package com.wzy.exportexcel.excelTask.impl;

import com.wzy.exportexcel.common.TaskHandleStatus;
import com.wzy.exportexcel.excelTask.ExcelTaskService;
import com.wzy.exportexcel.excelTask.domain.ExcelTask;
import com.wzy.exportexcel.excelTask.mapper.ExcelTaskMapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class ExcelTaskServiceImpl implements ExcelTaskService {
    @Resource
    private ExcelTaskMapper excelTaskMapper;
    @Override
    public void save(ExcelTask excelTask) {
        excelTaskMapper.insert(excelTask);
    }

    @Override
    public Integer updateById(ExcelTask excelTask) {
        return excelTaskMapper.updateByPrimaryKey(excelTask);
    }

    @Override
    public void updateStatus(Long taskId, TaskHandleStatus status) {
        excelTaskMapper.updateStatusById(taskId, status.getCode());
    }
}
